package com.example.productviewservicefeign.controller;

import com.example.productviewservicefeign.dao.entity.Product;
import com.example.productviewservicefeign.service.ProductService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
public class ApiController {

    @Autowired
    private ProductService productService;
    @GetMapping("/apiproducts")
    public List<Product> listProducts(Model model){
        List<Product> products=productService.listProduct();
        return products;
    }

}
